import { taskType } from "../../../enum"
import { creepNameToObj, objIDToObj } from "../../../tools/baseTools"
import { changeCreepRule, creepGetSource, creepGetTask, creepMoveExtesion } from "../../../tools/tools/creepTool"

export default {
    run: function (creep) {
        // 任务池
        let taskPool = [taskType.needResource]
        creep = creepNameToObj(creep)
        if (!creep.memory.currentTaskID) changeCreepRule(creep) // 每一个creep都需要存在一个无currentTaskID的情况
        if (creep.memory.state.isWorking) {
            // 工作逻辑
            let isRuning = false
            let getTaskResult = creepGetTask(creep, taskPool)       // 只获取任务id
            let taskDeta = getTaskResult['taskDeta']                // 任务详情
            if (getTaskResult['taskID']) {
                switch (getTaskResult['taskType']) {
                    case taskType.needResource:      
                        isRuning = false
                        // 资源需求任务执行逻辑
                        break;
                    default:
                        break;
                }
            }
            if (!isRuning) {
                // TODO:无任务情况下的逻辑
            }

        } else {
            // 准备逻辑
            creepGetSource({ creep: creep, room: creep.room, sourceType: creep.memory.params.resouce })
        }
    }
}